<!DOCTYPE html >
<html>
<head>
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.bar.js" ></script>
    
    <title>RGraph demo: A 3D Bar chart with multiple rows</title>
    
    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A 3D Bar chart with multiple rows" />
    

</head>
<body>

    <!-- Share buttons -->
    <p style="float: right">
        <script>
            document.write('<a href="" target="_blank" onclick="window.open(\'https://www.facebook.com/sharer/sharer.php?u=http://www.rgraph.net' + location.pathname + '\', null, \'top=50,left=50,width=600,height=368\'); return false"><img src="../images/facebook-large.png" width="200" height="43" alt="Share on Facebook" border="0" title="Visit the RGraph Facebook page" id="facebook_link" /></a>&nbsp;');
            document.write('<a href="https://twitter.com/_rgraph" target="_blank" onclick="window.open(\'https://twitter.com/intent/tweet?text=Check%20out%20this%20demo%20of%20RGraph:%202D/3D%20JavaScript%20charts%20-%20Free%20and%20Open%20Source%20http://www.rgraph.net' + location.pathname + '\', null, \'top=50,left=50,width=700,height=400\'); return false"><img src="../images/twitter-large.png" width="200" height="43" alt="Share on Twitter" border="0" title="Mention RGraph on Twitter" id="twitter_link" /></a>');
        </script>
    </p>


    <h1>A 3D Bar chart with multiple rows</h1>
    
    <p>
        This style of 3D chart is not supported natively but is pretty easy to
        achieve - especially as all the source code is below and you can just
        copy it!
    </p>

    <canvas id="cvs" width="650" height="300">[No canvas support]</canvas>

    <script>
        var gutterLeft   = 120,
            gutterRight  = 25,
            gutterTop    = 45,
            gutterBottom = 125,
                 hmargin = 15,
                    ymax = 35,
            
            data = [

                // If you don't need a third dataset take out this FIRST
                // dataset and replace it with the word: null

                // null, // [12,16,10,12,13,15,16]
                [5,16,10,12,13,15,16],

                [20,21,24,23,18,19,20],
                [35,34,32,28,26,35,34]
            ],
            
            colors = [
                'Gradient(#696:#0f0:#0f0)',
                'Gradient(#966:#f00:#f00)',
                'Gradient(#669:blue:blue)'
            ],
            
            labels = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];




        var bar = new RGraph.Bar({
            id: 'cvs',
            data: data[2],
            options: {
                textAccessible: true,
                variant: '3d',
                variantThreedYaxis: false,
                variantThreedXaxis: false,
                strokestyle: 'rgba(0,0,0,0)',
                colors: [colors[2]],
                shadow: true,
                shadowOffsetx: 10,
                //backgroundGrid: false,
                backgroundGridColor: '#ccc',
                backgroundGridAutofitNumhlines: 5,
                backgroundGridAutofitNumvlines: 14,
                scaleZerostart: true,
                axisColor: '#ddd',
                ylabels: false,
                gutterBottom: gutterBottom,
                gutterTop: gutterTop,
                gutterLeft: gutterLeft,
                gutterRight: gutterRight,
                hmargin: hmargin,
                ymax: ymax,
                noaxes: true
            }
        }).draw();

        var bar2 = new RGraph.Bar({
            id: 'cvs',
            data: data[1],
            options: {
                textAccessible: true,
                variant: '3d',
                variantThreedYaxis: false,
                variantThreedXaxis: false,
                strokestyle: 'rgba(0,0,0,0)',
                colors: [colors[1]],                
                shadow: true,
                shadowOffsetx: 10,
                shadowColor: 'rgba(0,0,0,0.5)',
                backgroundGrid: false,
                axisColor: '#ddd',
                ylabels: !data[0] ? true : false,
                labels: !data[0] ? labels : [],
                gutterBottom: gutterBottom - 10,
                gutterTop: gutterTop + 10,
                gutterLeft: gutterLeft - 20,
                gutterRight: gutterRight + 20,
                hmargin: hmargin,
                ymax: ymax,
                noaxes: true
            }
        }).draw();


        if (data[0]) {
            var bar = new RGraph.Bar({
                id: 'cvs',
                data: data[0],
                options: {
                    textAccessible: true,
                    variant: '3d',
                    variantThreedYaxis: false,
                    variantThreedXaxis: false,
                    strokestyle: 'rgba(0,0,0,0)',
                    colors: [colors[0]],
                    labels: labels,
                    shadow: true,
                    shadowOffsetx: 10,
                    shadowColor: 'rgba(0,0,0,0.5)',
                    backgroundGrid: false,
                    axisColor: '#ddd',
                    unitsPost: 'km',
                    gutterTop: gutterTop + 20,
                    gutterBottom: gutterBottom - 20,
                    gutterLeft: gutterLeft - 40,
                    gutterRight: gutterRight + 40,
                    hmargin: hmargin,
                    ymax: ymax,
                    noaxes: true,
                    scaleZerostart: true
                }
            }).draw();
        }
    </script>




    <p />



    This goes in the documents header:
    <pre class="code">
&lt;script src="RGraph.common.core.js"&gt;&lt;/script&gt;
&lt;script src="RGraph.bar.js"&gt;&lt;/script&gt;
</pre>
    
    Put this where you want the chart to show up:
    <pre class="code">
&lt;canvas id="cvs" width="650" height="300"&gt;
    [No canvas support]
&lt;/canvas&gt;
</pre>

    This is the code that generates the chart:
    <pre class="code">
&lt;script&gt;
    var gutterLeft   = 120,
        gutterRight  = 25,
        gutterTop    = 45,
        gutterBottom = 125,
             hmargin = 15,
                ymax = 35,
        
        data = [

            // If you don't need a third dataset take out this FIRST
            // dataset and replace it with the word: null

            // null, // [12,16,10,12,13,15,16]
            [5,16,10,12,13,15,16],

            [20,21,24,23,18,19,20],
            [35,34,32,28,26,35,34]
        ],
        
        colors = [
            'Gradient(#696:#0f0:#0f0)',
            'Gradient(#966:#f00:#f00)',
            'Gradient(#669:blue:blue)'
        ],
        
        labels = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];




    var bar = new RGraph.Bar({
        id: 'cvs',
        data: data[2],
        options: {
            textAccessible: true,
            variant: '3d',
            variantThreedYaxis: false,
            variantThreedXaxis: false,
            strokestyle: 'rgba(0,0,0,0)',
            colors: [colors[2]],
            shadow: true,
            shadowOffsetx: 10,
            //backgroundGrid: false,
            backgroundGridColor: '#ccc',
            backgroundGridAutofitNumhlines: 5,
            backgroundGridAutofitNumvlines: 14,
            scaleZerostart: true,
            axisColor: '#ddd',
            ylabels: false,
            gutterBottom: gutterBottom,
            gutterTop: gutterTop,
            gutterLeft: gutterLeft,
            gutterRight: gutterRight,
            hmargin: hmargin,
            ymax: ymax,
            noaxes: true
        }
    }).draw();

    var bar2 = new RGraph.Bar({
        id: 'cvs',
        data: data[1],
        options: {
            textAccessible: true,
            variant: '3d',
            variantThreedYaxis: false,
            variantThreedXaxis: false,
            strokestyle: 'rgba(0,0,0,0)',
            colors: [colors[1]],                
            shadow: true,
            shadowOffsetx: 10,
            shadowColor: 'rgba(0,0,0,0.5)',
            backgroundGrid: false,
            axisColor: '#ddd',
            ylabels: !data[0] ? true : false,
            labels: !data[0] ? labels : [],
            gutterBottom: gutterBottom - 10,
            gutterTop: gutterTop + 10,
            gutterLeft: gutterLeft - 20,
            gutterRight: gutterRight + 20,
            hmargin: hmargin,
            ymax: ymax,
            noaxes: true
        }
    }).draw();


    if (data[0]) {
        var bar = new RGraph.Bar({
            id: 'cvs',
            data: data[0],
            options: {
                textAccessible: true,
                variant: '3d',
                variantThreedYaxis: false,
                variantThreedXaxis: false,
                strokestyle: 'rgba(0,0,0,0)',
                colors: [colors[0]],
                labels: labels,
                shadow: true,
                shadowOffsetx: 10,
                shadowColor: 'rgba(0,0,0,0.5)',
                backgroundGrid: false,
                axisColor: '#ddd',
                unitsPost: 'km',
                gutterTop: gutterTop + 20,
                gutterBottom: gutterBottom - 20,
                gutterLeft: gutterLeft - 40,
                gutterRight: gutterRight + 40,
                hmargin: hmargin,
                ymax: ymax,
                noaxes: true,
                scaleZerostart: true
            }
        }).draw();
    }
&lt;/script&gt;
</pre>



    

    <p>
        <a href="./">&laquo; Back</a>
    </p>

</body>
</html>